package com.mall.xiaomi.controller;

import com.mall.xiaomi.pojo.Category;
import com.mall.xiaomi.service.CategoryService;
import com.mall.xiaomi.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName CategoryController
 * @Description TODO
 * @action luoliang
 * @Data 2021/2/26 10:22
 * @Version 1.0
 */
@RestController
@RequestMapping("/category")
public class CategoryController  {

    @Autowired
    private CategoryService categoryService;
    @Autowired
    private ResultMessage resultMessage;

    @GetMapping("")
    public ResultMessage category(){
        List<Category> all = categoryService.getAll();
        resultMessage.success("200",all);
        return resultMessage;
    }
}
